-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm!
Thanks @liamappelbe!
|
||
@end | ||
|
||
StaticFuncTestObj* staticFuncOfObject(StaticFuncTestObj* a) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move these (the actual functions used in the test) up, and the helper object down? Or does ObjC require an ordering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Just need to have the interface decl above them I think.
calloc.free(gcNow); | ||
} | ||
|
||
Pointer<Int32> staticFuncOfObjectRefCountTest(Allocator alloc) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems this only has one call site, is this because of scoping that it's in a separate function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I use the function scoping and doGC()
to ensure that all the wrapper objects are collected.
Use Dart wrapper objects when passing args or receiving results from ObjC static functions.
For ref counting, we assume functions do not return a retained reference by default (so we have to retain it ourselves). We also parse the function annotations, and if we see a
NS_RETURNS_RETAINED
, then the function is returning a retained reference, so we don't have to manually retain it in that case.Fixes dart-lang/native#496, dart-lang/native#308